package com.lyc.log4j;

import org.apache.log4j.spi.LoggingEvent;

import java.io.ObjectInputStream;
import java.net.Socket;

public class LogRunner implements Runnable{

    private ObjectInputStream ois;

    public LogRunner(Socket client) {
        try {
            this.ois = new ObjectInputStream(client.getInputStream());
        } catch (Exception e) {
        }
    }

    public void run() {
        try {
            while (true) {
                LoggingEvent event = (LoggingEvent) ois.readObject();
                System.out.println(event.getLoggerName() + ":  " + event.getMessage());
            }
        } catch (Exception e) {
        } finally {
        }
    }
}
